<?php
/**
 * Created by PhpStorm.
 * User: chen
 * Date: 18-5-27
 * Time: 下午2:11
 */

namespace App\Http\Controllers\Core;


use App\Http\Controllers\Controller;
use App\ServiceHandler\Common\AuthorityUsageService;
use App\Tool\Error;
use Illuminate\Http\Request;

class AuthorityUsageController extends Controller
{
    /**
     * 给用户授权
     * @param Request $request
     */
    public function saveUserAuthority(Request $request){
        AuthorityUsageService::setUserAuthorities($request->uid, $request->authorities);
    }

    /**
     * 给职务授权
     * @param Request $request
     */
    public function saveDutyAuthority(Request $request){

    }

    public function queryUserAuthoritiesById(Request $request){
        $authorities = User::select('authorities')->find($request->uid);
        return $this->success(Error::OK, unserialize($authorities));
    }
}